<template>
  <div class="home">
      <h1>你好：{{user.username}}</h1>
      <el-button @click="fun" type="success">测试hello</el-button>
  </div>
</template>

<script>
// @ is an alias to /src

export default {
  name: 'HomeView',
  data(){
    return{
       user:''
    }
  },
   mounted() {
      this.user=JSON.parse( window.sessionStorage.getItem("user"))
  },
  methods:{
      fun(){
        this.getRequest("hello").then(resp =>{
          // console.log(resp.data)
          // console.log(resp.data.flag)
          // console.log(resp.data.message)
           if(resp.data.code === 200){
             console.log(resp.data.message);
              this.$message.success(resp.data.message);
           }
        })
      }
  }
}
</script>
